// mockData.js
export const categories = [
  { value: "all", label: "全部分类" },
  { value: "movie", label: "电影" },
  { value: "tv", label: "剧集" },
  { value: "music", label: "音乐" },
  { value: "game", label: "游戏" }
];

export const generateMockTorrents = () => {
  const formats = ['4K REMUX', 'BluRay 1080p', 'WEB-DL 720p'];
  const uploaders = [
    { name: '影音达人', id: 'uploader_1' },
    { name: '资源分享家', id: 'uploader_2' },
    { name: '蓝光爱好者', id: 'uploader_3' },
    { name: '高清收藏者', id: 'uploader_4' }
  ];
  
  return Array.from({ length: 15 }, (_, i) => {
    const baseSize = 1024 ** 2 * (i + 1) * 100;
    return {
      id: i + 1,
      name: `测试资源 ${i + 1} - ${formats[i % 3]}`,
      category: categories[(i % 4) + 1].value,
      size: baseSize,
      description: `【${formats[i % 3]}】虚拟资源描述 ${i + 1}\n这是由${uploaders[i % 4].name}上传的高质量资源`,
      uploader: uploaders[i % 4],
      downloads: Math.floor(Math.random() * 1000) + 100,
      rating: Number((Math.random() * 4 + 1).toFixed(1)),
      createdAt: new Date(Date.now() - i * 36e5).toISOString(),
      tags: [
        ['HDR', '杜比视界'][i % 2],
        ['中文字幕', '双语字幕'][i % 2],
        ['蓝光原盘', 'Remux'][i % 2]
      ].filter(Boolean),
      comments: Array.from({ length: i % 5 }, (_, ci) => {
        const userId = `user_${(i + ci) % 10}`;
        return {
          id: `comment_${i}_${ci}`,
          user: {
            id: userId,
            name: `用户_${(i + ci) % 10}`,
            avatar: `https://randomuser.me/api/portraits/${userId.endsWith('0') ? 'men' : 'women'}/${(i + ci) % 10}.jpg`
          },
          content: `第${ci + 1}条测试评论 - 资源质量${['一般', '良好', '优秀'][ci % 3]}`, 
          time: new Date(Date.now() - (i + ci) * 360000).toISOString(),
          rating: (ci % 5) + 1,
          likes: Math.floor(Math.random() * 10)
        };
      })
    };
  });
};

export const mockUser = {
  username: '测试用户',
  ratio: 2.5,
  uploaded: 5368709120,    // 5 GB
  downloaded: 2147483648,  // 2 GB
  avatar: 'https://randomuser.me/api/portraits/men/1.jpg',
  level: 'VIP3',
  bonusPoints: 1500
};

export const mockRankings = {
  upload: Array.from({length: 10}, (_, i) => ({
    rank: i + 1,
    userId: 1000 + i,
    username: `上传达人${i + 1}`,
    userLevel: Math.floor(Math.random() * 5) + 1,
    score: 50000000 - i * 5000000,
    scoreDisplay: `${50 - i * 5}GB`,
    type: "upload"
  })),
  seeding: Array.from({length: 10}, (_, i) => ({
    rank: i + 1,
    userId: 2000 + i,
    username: `保种专家${i + 1}`,
    userLevel: Math.floor(Math.random() * 5) + 1,
    score: 259200 - i * 21600,
    scoreDisplay: `${3.0 - i * 0.25}天`,
    type: "seeding"
  }))
}